package com.lrkj.lease.service.impl;

import java.util.List;
import com.lrkj.common.utils.DateUtils;
import com.lrkj.common.utils.SecurityUtils;
import com.lrkj.common.utils.uuid.IdUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.lrkj.lease.mapper.LeaseRecordMapper;
import com.lrkj.lease.domain.LeaseRecord;
import com.lrkj.lease.service.ILeaseRecordService;

/**
 * 合同变更记录Service业务层处理
 *
 * @author yajun_ren
 * @date 2022-08-18
 */
@Service
public class LeaseRecordServiceImpl implements ILeaseRecordService
{
    @Autowired
    private LeaseRecordMapper leaseRecordMapper;

    /**
     * 查询合同变更记录
     *
     * @param id 合同变更记录ID
     * @return 合同变更记录
     */
    @Override
    public LeaseRecord selectLeaseRecordById(String id)
    {
        return leaseRecordMapper.selectLeaseRecordById(id);
    }

    /**
     * 查询合同变更记录列表
     *
     * @param leaseRecord 合同变更记录
     * @return 合同变更记录
     */
    @Override
    public List<LeaseRecord> selectLeaseRecordList(LeaseRecord leaseRecord)
    {
        return leaseRecordMapper.selectLeaseRecordList(leaseRecord);
    }

    /**
     * 新增合同变更记录
     *
     * @param leaseRecord 合同变更记录
     * @return 结果
     */
    @Override
    public int insertLeaseRecord(LeaseRecord leaseRecord)
    {
        leaseRecord.setId(IdUtils.simpleUUID());
        leaseRecord.setCreateTime(DateUtils.getNowDate());
        leaseRecord.setCreateBy(SecurityUtils.getUsername());
        return leaseRecordMapper.insertLeaseRecord(leaseRecord);
    }

    /**
     * 修改合同变更记录
     *
     * @param leaseRecord 合同变更记录
     * @return 结果
     */
    @Override
    public int updateLeaseRecord(LeaseRecord leaseRecord)
    {
        return leaseRecordMapper.updateLeaseRecord(leaseRecord);
    }

    /**
     * 批量删除合同变更记录
     *
     * @param ids 需要删除的合同变更记录ID
     * @return 结果
     */
    @Override
    public int deleteLeaseRecordByIds(String[] ids)
    {
        return leaseRecordMapper.deleteLeaseRecordByIds(ids);
    }

    /**
     * 删除合同变更记录信息
     *
     * @param id 合同变更记录ID
     * @return 结果
     */
    @Override
    public int deleteLeaseRecordById(String id)
    {
        return leaseRecordMapper.deleteLeaseRecordById(id);
    }
    /**
     * 批量新增合同变更记录信息
     *
     * @param leaseRecords 合同变更记录对象
     */
    public int batchAddData(List<LeaseRecord> leaseRecords)
    {
           return leaseRecordMapper.batchAddData(leaseRecords);
    }
}
